﻿@using System.Web.UI.WebControls
@using DevExpress.Web.ASPxGridView
@using Dogshow.Model
@using DevExpress.Web.Mvc.UI
@model IEnumerable<RasaPsa>

@Html.DevExpress().GridView(
    s =>
    {
        s.Name = "gvRasePasa";
        s.SettingsBehavior.AllowGroup = true;
        s.Caption = "Rase pasa";
        s.KeyFieldName = "Id";
        
        s.Width = Unit.Pixel(500);
        s.CallbackRouteValues = new { Controller = "RasePasa", Action = "VratiRasePasaPartial" };
       
        s.Columns.Add(x => { 
                               x.Caption = "Naziv rase"; 
                               x.FieldName = "NazivRase";
                               x.Width = Unit.Pixel(200);
                           });
        s.Columns.Add(x =>
        {
            x.Caption = "Originalni naziv";
            x.FieldName = "OriginalniNazivRase";
            x.Width = Unit.Pixel(200);
        });
        s.Columns.Add(x =>
                      {
                          x.Name = "FCI grupa";
                          x.Caption = "FCI grupa";
                          x.FieldName = "FciGrupa.Id";
                          x.GroupIndex = 0;
                      });
        s.SetGroupRowContentTemplateContent(x => @Html.RenderPartial("GroupRowTemplate", x.DataItem));
        s.SettingsEditing.UpdateRowRouteValues = new {Controller = "RasePasa", Action = "AzurirajRasuPsa"};
        s.SettingsPager.PageSize = 25;
        s.Settings.ShowFilterRow = true;
        s.SettingsLoadingPanel.Text = "Učitavam podatke...";
        s.SettingsBehavior.EnableRowHotTrack = true;
        s.SettingsEditing.Mode = GridViewEditingMode.Inline;
        s.SettingsEditing.ShowModelErrorsForEditors = true;
        s.CommandColumn.Visible = true;
        s.CommandColumn.ButtonType = ButtonType.Image;
        s.CommandColumn.EditButton.Visible = true;
        s.CommandColumn.EditButton.Image.ToolTip = "Izmeni";
        s.CommandColumn.EditButton.Image.Url = @Url.Content("~/Content/images/edit.png");
        s.CommandColumn.UpdateButton.Image.ToolTip = "Prihvati";
        s.CommandColumn.UpdateButton.Image.Url = @Url.Content("~/Content/images/ok.png");
        s.CommandColumn.CancelButton.Image.ToolTip = "Otkaži";
        s.CommandColumn.CancelButton.Image.Url = @Url.Content("~/Content/images/cancel.png");
    }
).Bind(Model).GetHtml()